package cn.cdyx.common.utils;

import cn.cdyx.common.mapper.TBSYSPARAMMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @Author Watermelon
 * @Date 2023-01-14 17:49
 * 流水号工具类
 */
@Component
@Slf4j
public class YXSysNumberUtil {
    @Autowired
    private TBSYSPARAMMapper tbsyspatamMapper;
    private static YXSysNumberUtil yxSysNumberUtil;

    @PostConstruct
    public void init(){
        yxSysNumberUtil = this;
        yxSysNumberUtil.tbsyspatamMapper = this.tbsyspatamMapper;
    }

    public static String getSysNumber2(String CBH,int Diff,String TJ){
        String sysNumber2 = yxSysNumberUtil.tbsyspatamMapper.getSysNumber2(CBH, Diff, TJ);
        return sysNumber2;
    }

    public static String getSysNumber(String CBH,int Diff,int numberSize){
        String sysNumber = yxSysNumberUtil.tbsyspatamMapper.getSysNumber(CBH, Diff);
        String sysNumber1 = String.format("%09d", Integer.valueOf(sysNumber));
        return sysNumber1;
    }
}
